import requests
from datetime import datetime, timedelta

# 起始和结束日期
start_date = datetime(2025, 7, 10)
end_date = datetime(2025, 7, 10)

# 构建基础URL
base_url = "http://43.138.150.59:8088/nbpAdmin/kanban/statistics/LinkInsight"
#base_url = "http://172.20.150.233:8088/nbpAdmin/kanban/statistics/LinkInsight"

# 请求头
headers = {
    'User-Agent': 'Apifox/1.0.0 (https://apifox.com)'
}

# 循环发送请求
current_date = start_date
while current_date <= end_date:
    date_str = current_date.strftime("%Y-%m-%d")
    url = f"{base_url}?date={date_str}"

    print(f"正在请求日期: {date_str}")

    try:
        response = requests.get(url, headers=headers, timeout=10)
        print(f"响应状态码: {response.status_code}")
        print(response.text)  # 打印返回内容
    except Exception as e:
        print(f"请求失败: {e}")

    # 下一天
    current_date += timedelta(days=1)